package com.hades.xq.miaoshao.validator;


import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class ValidatorResult {

    /**
     * 校验是否有错误
     */
    private boolean hasErrors = false;

    /**
     * 存放错误信息
     */
    private Map<String, String> errrMsgMap = new HashMap<>();

    /**
     * 实现通用的格式化字符串信息获取错误信息的msg方法
     *
     * @return
     */
    public String getErrMsg() {
        return StringUtils.join(errrMsgMap.values().toArray(), ",");
    }


    public boolean isHasErrors() {
        return hasErrors;
    }

    public void setHasErrors(boolean hasErrors) {
        this.hasErrors = hasErrors;
    }

    public Map<String, String> getErrrMsgMap() {
        return errrMsgMap;
    }

    public void setErrrMsgMap(Map<String, String> errrMsgMap) {
        this.errrMsgMap = errrMsgMap;
    }
}
